package com.gmail.blackdog1987.onedollar.entity;

import javax.persistence.*;
import java.math.BigDecimal;
import java.sql.Timestamp;

/**
 * Created by dongguochao on 12/7/15.
 */
@Entity
@Table(name = "t_user_charge", schema = "", catalog = "onedollar")
public class TUserChargeEntity {
    public static final int ALIPAY = 0;
    public static final int WECHAT = 1;
    public static final int BANK = 2;
    public static final int WEB = 3;
    public static final int GETLUCKYMONEY = 4;
    public static final int GETBACKLUCKYMONEY = 5;
    public static final int BONUS = 6;
    public static final int WITHDRAW = 10;
    public static final int SENDLUCKYMONEY = 11;
    public static final int BUY = 12;
    public static final int WXBUY = 14;
    public static final int ALIBUY = 13;


    private int id;
    private Integer userId;
    private Integer channel;
    private BigDecimal value;
    private String chargecode;
    private Timestamp createtime;
    private Integer type;

    @Id
    @GeneratedValue
    @Column(name = "id", nullable = false, insertable = false, updatable = true)
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    @Basic
    @Column(name = "user_id", nullable = true, insertable = true, updatable = true)
    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    @Basic
    @Column(name = "channel", nullable = true, insertable = true, updatable = true)
    public Integer getChannel() {
        return channel;
    }

    public void setChannel(Integer channel) {
        this.channel = channel;
    }

    @Basic
    @Column(name = "value", nullable = true, insertable = true, updatable = true, precision = 2)
    public BigDecimal getValue() {
        return value;
    }

    public void setValue(BigDecimal value) {
        this.value = value;
    }

    @Basic
    @Column(name = "chargecode", nullable = true, insertable = true, updatable = true, length = 65535)
    public String getChargecode() {
        return chargecode;
    }

    public void setChargecode(String chargecode) {
        this.chargecode = chargecode;
    }

    @Basic
    @Column(name = "createtime", nullable = true, insertable = true, updatable = true)
    public Timestamp getCreatetime() {
        return createtime;
    }

    public void setCreatetime(Timestamp createtime) {
        this.createtime = createtime;
    }

    @Basic
    @Column(name = "type", nullable = true, insertable = true, updatable = true)
    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TUserChargeEntity that = (TUserChargeEntity) o;

        if (id != that.id) return false;
        if (userId != null ? !userId.equals(that.userId) : that.userId != null) return false;
        if (channel != null ? !channel.equals(that.channel) : that.channel != null) return false;
        if (value != null ? !value.equals(that.value) : that.value != null) return false;
        if (chargecode != null ? !chargecode.equals(that.chargecode) : that.chargecode != null) return false;
        if (createtime != null ? !createtime.equals(that.createtime) : that.createtime != null) return false;
        if (type != null ? !type.equals(that.type) : that.type != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id;
        result = 31 * result + (userId != null ? userId.hashCode() : 0);
        result = 31 * result + (channel != null ? channel.hashCode() : 0);
        result = 31 * result + (value != null ? value.hashCode() : 0);
        result = 31 * result + (chargecode != null ? chargecode.hashCode() : 0);
        result = 31 * result + (createtime != null ? createtime.hashCode() : 0);
        result = 31 * result + (type != null ? type.hashCode() : 0);
        return result;
    }
}
